import instance from "./axios";

interface ApiResponse<T=unknown> {
  code: number;
  data: T;
  message: string;
}


export const getI18nList =  <T>(data: { current: string; currentSize: string }) => {
  const usp = new URLSearchParams(data);
  const result =  instance.get(`/i18n/list?${usp.toString()}`) 
  // 此时打印的是接口返回的具体数据（如 { code: 200, data: ... }）
  console.log(result); 
  return result;
};
export const deleteI18nList = (code: number | string) => {
  // 直接使用ID参数
  const result =  instance.delete(`/i18n/delete/${code}`) 
  console.log(result); 
  return result;
};
// src/Api/i18n.ts 完善updateI18n方法
interface updateParams {
  code: string;
  remarks: string;
  languageTexts: {
    languageTag: string;
    message: string;
  }[];
}
export const updateI18n = (id: number | string, data: updateParams) => {
  const result = instance.post(`/i18n/update`, {id,...data});

  console.log('更新请求参数:', { id, data });
  console.log('请求URL:', `/i18n/update/${id}`);
  return result;
};